package org.mq.mymq.nameserver.replication;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @ClassName ReplicationTask
 * @Description 任务接口
 * @Author jiarong_ye
 * @Date 2025/6/20 14:27
 * @Version 1.0
 */
public abstract class ReplicationTask {
    private static final Logger log = LoggerFactory.getLogger(ReplicationTask.class);
    private String taskName;

    public ReplicationTask(String taskName) {
        this.taskName = taskName;
    }

    public void startTaskAsync() {
        Thread task = new Thread(() -> {
            log.info("start job:" + taskName);
            startTask();
        });
        task.setName(taskName);
        task.start();
    }

    abstract void startTask();
}
